<%@include file="/pub/import.jsp"%>
<%@include file="/pub/header.jsp"%>
<%
    Page pager = new Page();
    int pageindex = RequestUtil.getIntParameter(request,"i",1);
    pager.setCurrentPage(pageindex);
    pager.setEveryPage(10);
    Result result = ProjectHandler.list(pager);
    List projectList = result.getContent();
    context.put("projectList", result.getContent());
    context.put("pager", result.getPage());    
    
    Map<Integer,List<User>> userMap = new HashMap<Integer,List<User>>();
    for(int i=0; i<projectList.size(); i++) {
      List<User> userList = new ArrayList<User>();
      Project p = (Project) projectList.get(i);
	    if(!StringUtils.isEmpty(p.getScoreUser())) {
	      String[] userArr = p.getScoreUser().split(",");
	      for(String userId : userArr) {
	        userList.add(UserHandler.getUser(Integer.parseInt(userId)));
	      }
	    }
	    userMap.put(p.getId(),userList);
    }
    context.put("DateUtil", new DateUtil());
    context.put("userMap", userMap);
    context.put("now", new Date());
    out.println(TemplateUtil.getOutput(context,"/view/project/projectManage.html"));
%>
<%@include file="/pub/footer.jsp"%>